<?php
/**
 * 文件方式记录日志
 *
 * @author: yanxs <541139655@qq.com>
 * @version: 1.0
 * @date: 2019/8/22
 */

namespace App\Services\Common\Log;


use Illuminate\Support\Facades\Log;

class File implements LogInterface
{
    protected $dir ; //所在目录
    public function __construct()
    {
        //历史原因，默认做异常日志,因为这一块之前只纯粹做异常日志的
        $this->dir = config('common.log.default_table');
    }

    /**
     * 设置一级目录
     * @param $collection
     */
    public function setCollection($collection)
    {
        // TODO: Implement setCollection() method.
        $this->dir = $collection;
    }

    /**
     * 记录日志
     * @param $data
     */
    public function record($data)
    {
        Log::channel($this->dir)->info($data);
        //file_put_contents()
    }
}
